from flask import Flask,request,jsonify
from ocr import OCREngine

app=Flask(__name__)
app.config['JSON_AS-ASCII']=False

@app.route("/ocr_ticket",methods=["GET"])
def ocr_ticket():
    file_name=request.args.get('file_name')

    tFrom,tTo,tNumber=ocr.run(file_name)
    return jsonify({
        "我的学号":"[7210764124]",
        "出发":tFrom,
        "到达":tTo,
        "车次":tNumber
    })

if __name__=='__main__':
    ocr=OCREngine("/root/linux_midterm/img/railway_ticket.jpg")
    app.run(host='0.0.0.0',port='80')
